[Core/Proto] Fix VarInt negative value encoding and MultiMsg recursion #84
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses two critical issues identified during message serialization:
1. Fix VarInt Encoding for Negative Values ([Proto])
ProtoHelper.GetVarIntLengthuseduint.CreateSaturatingwhich converted negative values to 0, causingIndexOutOfRangeExceptioninVarIntLengths32.ProtoWriter.EncodeVarIntperformed a signed comparison (value < 0x80), causing negative integers (like -1) to be written as a single byte0xFF, corrupting the protobuf stream (e.g., breaking Base64 image uploads).CreateTruncatingand forcedulongcasting for unsigned comparison to preserve bit patterns.2. Fix Forward Message Image Upload ([Core])
MultiMsgEntity.Preprocessonly uploaded the outer container but failed to upload internal entities (like images). This resulted in emptyMsgInfoduring serialization and caused-400 Internal Server Error.Regression tests have been added to ensure stability.